iT邦幫忙

2021 iThome 鐵人賽

DAY 14
0
自我挑戰組

從Agile PLM 移轉 Aras PLM大小事系列 第 14

14.移轉 Aras PLM大小事-開發報表 Where Used Top Level Product

  • 分享至 

  • xImage
  •  

本篇放上獲得最上階產品料號的作法
1.建立報表
2.設定SQL語法
3.設定Method
4.設定XSLT
參考程式碼
https://github.com/panda0909/Aras-PLM-Exercise/tree/master/Report/Where%20Used%20Top%20Level%20Product

1.建立報表
https://ithelp.ithome.com.tw/upload/images/20210914/201065032Pfqec2070.png
2.設定SQL語法-用來查詢最上階層料號
https://ithelp.ithome.com.tw/upload/images/20210914/20106503B1CfNfu8B8.png

---遞迴查詢
with [bom_new] as (
select pbom.SOURCE_ID as tr_sid,pbom.RELATED_ID as tr_rid,p.ITEM_NUMBER as parent,pr.ITEM_NUMBER as son ,pr.NAME,1 as level from [innovator].[PART_BOM] as pbom
inner join [innovator].[part] as p on pbom.SOURCE_ID=p.id
inner join [innovator].[part] as pr on pbom.RELATED_ID=pr.id
where pr.id=@PART_ID and p.IS_CURRENT = '1'
---想要查詢的零件料號

---聯集所有上層料號
UNION ALL
select pbom2.SOURCE_ID as tr_sid,pbom2.RELATED_ID as tr_rid,p.ITEM_NUMBER as parent,pr.ITEM_NUMBER as son,pr.NAME,level + 1
from [innovator].[PART_BOM] as pbom2
inner join [bom_new] as bnew on bnew.tr_sid=pbom2.RELATED_ID
inner join [innovator].part as p on pbom2.SOURCE_ID =p.id
inner join [innovator].[part] as pr on pbom2.RELATED_ID=pr.id
where p.IS_CURRENT='1'
)
---料號中開頭為P成品件
select ta.parent as item_number from [bom_new] as ta where ta.parent like 'P%'

3.設定Method-透用Method呼叫查詢SQL

private Item GetAllItems(string part_id)
{
    Item callframe = inn.newItem("SQL", "SQL PROCESS");
    callframe.setProperty("name", "JPC_WhereUsedTopLevelBOM");
    callframe.setProperty("PROCESS", "CALL");
    callframe.setProperty("ARG1", part_id);
    
    return callframe.apply();
}

上一篇
13.移轉 Aras PLM大小事-報表 Where Used BOM
下一篇
15.移轉Aras PLM大小事-Part料號全域搜尋
系列文
從Agile PLM 移轉 Aras PLM大小事30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言